package sim.ring.gui.treedata;

import sim.ring.method.Method;

public class TMethod extends DataModel {
	
	public TMethod() {
		super();
		this.name = "New method";
		this.method = new Method();
	}
	
	public TMethod(String name) {
		super();
		this.name = name;
		this.method = null;
	}

	public TMethod(String name, int id) {
		super();
		this.name = name;
		this.method = null;
		this.id = id;
	}
	
	public void createMethod(String name, String classification, int stage, String shortNotation) {
		this.name = name;
		this.method = new Method(name, classification, stage, shortNotation);
	}
	
	public void createMethod(int id, String name, String classification, int stage, String shortNotation, String longNotation, int ringCount) {
		this.name = name;
		this.method = new Method(id, name, classification, stage, shortNotation, longNotation, ringCount);
	}
	
	public TMethod(String name, String classification, int stage, String shortNotation) {
		super();
		this.name = name;
		this.method = new Method(name, classification, stage, shortNotation);
	}
	
	public TMethod(int id, String name, String classification, int stage, String shortNotation, String longNotation, int ringCount) {
		super();
		this.name = name;
		this.method = new Method(id, name, classification, stage, shortNotation, longNotation, ringCount);
	}
	
	protected Method method;
	
	public void updateMethodName() {
		if (!this.name.equals(this.method.getName())) {
			this.method.setName(this.name);
		}
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}

	@Override
	public void accept(IDataModelVisitor visitor, Object args) {
		visitor.visitTMethod(this, args);
	}

	@Override
	public void add(DataModel model) { }

	@Override
	public void remove(DataModel model) { }

}
